/**
 * 学习记录列表 已完成
 * 
 * */

import React from 'react';
import { Link } from 'react-router-dom'
import { useMemo } from 'react';
import { formatTime } from '@/util/util'

import './style.less';

const List = (props) => {
  const { data } = props;
  const path = useMemo(() => {
    if (data.type === 0) return '/proDetail'
    else return '/medicalDetail'
  }, [data.type])
  return (
    <Link className="today-item" to={path + '?id=' + data.id}>
      <div className="today-item-t">
        <div className="today-item-t-img">
          <img src={data.listImgUrl} alt="" />
        </div>

        <div className="today-item-t-text">
        <p className="today-item-t-text-title">{data.title}</p>
          <p className="today-item-t-shortDesc">{data.shortDesc}</p>
        </div>
      </div>
      <div className="today-item-b">
        <p>发布于：{formatTime(data.pubTime)}</p>
        <div >学习进度 100%</div>
      </div>
    </Link>
  )
}


export default React.memo(List) 